/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BUS;
import DAO.HocSinhDAO;
import POJO.HocSinh;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JOptionPane;


/**
 *
 * @author CUCAINHO
 */
public class HocSinhBUS {
      public static void main(String[] args) {
        // TODO code application logic here
        HocSinhBUS hs = new HocSinhBUS();
        hs.GetListHocSinh(1);
        
    }
    
  
    public static ArrayList<HocSinh> GetListHocSinh(int option){ 
        
        try
        {
            ArrayList<HocSinh> lstHocSinh = new ArrayList<HocSinh>();
            lstHocSinh = HocSinhDAO.GetListHocSinh(option);
            return lstHocSinh;
        }catch(Exception ex)
        {
            System.out.println("Loi doc data!" + ex.toString());
            
        }
        
        return null;
        
        
        
        
    }
    
    public static int AddHocSinh(HocSinh hs){
        int kq = -1;
        try
        {
          kq = HocSinhDAO.AddHocSinh(hs);
        }catch(Exception ex)
        {
            System.out.println("Loi doc data!" + ex.toString());
            
        }
        
        return kq;
    }
    
    
    public static int UpdateHocSinh(HocSinh hs){
        int kq = -1;
      
        try
        {
            
            
    
           kq =  HocSinhDAO.UpdateHocSinh(hs);
    
            return kq;
            
        }catch(Exception ex)
        {
            System.out.println("Loi doc data!" + ex.toString());
            
        }
        
        return kq;
    }
    
     public static int DeleteHocSinh(int MaHS){
          int kq = -1;
       
        try
        {
           kq = HocSinhDAO.DeleteHocSinh(MaHS);
            return kq;
            
        }catch(Exception ex)
        {
            System.out.println("Loi doc data!" + ex.toString());
            
        }
        
        return kq;
     }
    
}
